#include "IMNetworkProcessor.h"
#include "IMNetworkProcessorPrivate.h"

void IMNetworkProcessorHandler::setNext(const std::string &name)
{
    if (name.empty())
    {
        return;
    }
    d_ptr->setNext(name);
}

void IMNetworkProcessorHandler::setNext(std::shared_ptr<IMNetworkProcessor> next)
{
    d_ptr->setNext(next);
}

void IMNetworkProcessorHandler::run()
{
    IMNetworkProcessor *temp = d_ptr->getNext().get();
    while (temp != nullptr)
    {
        temp->process();
        temp = temp->next().get();
    }
}